package 力扣日常刷题.木23一月.第16天316;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 帅小伙
 * @date 2022/3/16
 * @description
 */
public class Demo84数组组成最大数 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.nextLine();
        String[] sNums = in.substring(1, in.length() - 1).split(",");

        Arrays.sort(sNums,(a,b)->{
            return (b+a).compareTo(a+b);
        });

        StringBuilder sb = new StringBuilder();

        for (String sNum : sNums) {
            sb.append(sNum);
        }
        System.out.println(Integer.parseInt(sb.toString()));
    }
}
